package cn.edu.gsau.info.service.impl;

import cn.edu.gsau.info.dao.ZhengmingcailiangDao;
import cn.edu.gsau.info.models.Zhengmingcailiao;
import cn.edu.gsau.info.myenum.ModuleIdClass;
import cn.edu.gsau.info.service.IZhengmingcailiaoService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ZhengmingcailiaoServiceImpl extends ServiceImpl<ZhengmingcailiangDao, Zhengmingcailiao> implements IZhengmingcailiaoService {
    /**
     * @description:查找证明材料
     * @author: ltl
     * @date: 2022/11/24
     * @param: 表名数加记录数id
     * @return: 返回证明材料
     **/
    @Autowired
    ZhengmingcailiangDao zhengmingcailiangDao;

    @Override
    public List<Zhengmingcailiao> searchbymoduleidandrecoreid(int moduleid, long recoreid) {
        QueryWrapper qw = new QueryWrapper();
        qw.eq("moduleId", moduleid);
        qw.eq("recoreId",recoreid);
        List<Zhengmingcailiao> zhengmingcailiaos = zhengmingcailiangDao.selectList(qw);
        return zhengmingcailiaos;
    }

    @Override
    public List selectZMCL(Long id) {
        QueryWrapper qw = new QueryWrapper();
        qw.eq("moduleId", ModuleIdClass.HOUJIANG_id);
        qw.eq("recoreId",id);
        List<Zhengmingcailiao> zhengmingcailiaos = zhengmingcailiangDao.selectList(qw);
        return zhengmingcailiaos;
    }

    @Override
    public void delectById(Long id) {
        zhengmingcailiangDao.deleteById(id);
    }

    @Override
    public List<Zhengmingcailiao> selectZhengmingcailiao(int moduleId,long id){
        QueryWrapper wq=new QueryWrapper();
        wq.eq("moduleId",moduleId);
        wq.eq("recoreId",id);
        List<Zhengmingcailiao> list=zhengmingcailiangDao.selectList(wq);
        return list;
    }
}
